import request from '@/utils/request'

const api_name = "/admin/system/sysPost"   //ES6常量命名方式

export default {   
    getPageList(page,limit,SysUserQueryVo){
        return request({
            url:`${api_name}/${page}/${limit}`, 
            method: 'get',      //请求方式
            params: SysUserQueryVo //参数
        })
    },
    //查询全部
    getAll(){
      return request({
        url:`${api_name}`, 
        method: 'get',
    })
    },
//删除
    DeleteUser(id){
      return request({
        url:`${api_name}/${id}`, 
        method: 'delete',      //请求方式
      })
    },
//更新
    Updata(Post){
      return request({
        url:`${api_name}`, 
        method: 'put',
        data: Post
      })
    },
    //查询单个
    SelectByID(id){
        return request({
          url:`${api_name}/${id}`, 
          method: 'get',
        })
      },
//添加
    Add(Post){
      return request({
        url:`${api_name}`, 
        method: 'post',
        data: Post
      })
    },
//批量删除
    DeleteByIds(idList){
      return request({
        url: `${api_name}/batchRemove`,
        method: `delete`,
        data: idList
      })
    },
    //更改用户状态
    ChangeUserStatus(id,status){
        return request({
          url: `${api_name}/updataStatus/${id}/${status}`,
          method: `get`,
        })
      },
    //根据用户id查询用户角色和所有角色
    getPostsByUserId(userId) {
      return request({
        url: `${api_name}/toAssign/${userId}`,
        method: 'get'
      })
    },
    
}